#pragma once
#include <osgViewer/Viewer>
#include <osgEarth/Map>
#include <osgEarth/MapNode>
#include <osgEarthFeatures/FeatureSource> 
#include <osgEarthUtil/EarthManipulator>
#include <osgEarthSymbology/Style>
#include <osgEarthDrivers/vpb/VPBOptions>
#include <osgEarthDrivers/gdal/GDALOptions>
#include <osgEarthAnnotation/FeatureEditing>
#include <osgEarthAnnotation/LabelNode>
#include <osgEarthSymbology/TextSymbol>
#include <osgText/Text>
#include <OSGUIsh/EventHandler.hpp>
class  pickearth;
//stl
#include <map>

namespace BJ
{



	class mainView :
		public osgViewer::Viewer
	{
	public:
		mainView(osg::ArgumentParser & arg);
		void addPlane(double  Latitude,double longitude,double  Height ,double direction,double ancle);
	private:

		void  Init();
		void  EarthInit();
		void  CameraInit();
		bool  AirCraftHeart();
		bool  AirCraftTimer();
		void  GlibOpenThread();

		osgEarth::Symbology::Style   buildStyleSheet( const osg::Vec4 &color, float width );
		osg::ref_ptr<osgEarth::MapNode>  GetMap();
		osg::ref_ptr<osg::Group>  GetRoot();
		void InitStyle();

	private:

		osg::ref_ptr<osg::Group>  root;
		std::map<std::string,osg::ref_ptr<osg::Node>> namenode;
		osg::ref_ptr<osgEarth::Map>  map  ;
		osg::ref_ptr<osgEarth::MapNode>  mapnode;
		osg::ref_ptr<pickearth>  viewCamera;

		osg::ref_ptr< osgEarth::Features::FeatureSource > s_source;

		osg::ref_ptr<osgEarth::Annotation::LabelNode > updateText ;
		osg::ref_ptr<OSGUIsh::EventHandler>  nodehandler;
	protected:
		~mainView(void);
	};

}